<?php

function auth($usr,$pass){
    
    $cnx = new mycnx();
    $res = $cnx->select("select * from t_usuarios where usuario='$usr'");

    if ($res->num_rows > 0)
        {
            while ($row = mysqli_fetch_assoc($res))
                {

                    if($usr==$row['usuario'] && $pass==$row['clave'])
                        {
                            session_start();

                            $_SESSION['id_usuario']=$row['id_usuario'];
                            $_SESSION['usuario']=$row['usuario'];
                            $_SESSION['clave']=$row['clave'];
                            $_SESSION['nombre']=$row['nombre'];
                            $_SESSION['apellido']=$row['apellido'];
                            $_SESSION['mail']=$row['mail'];
                            $_SESSION['document_root']=$document_root;
                            return true;

                        }	
                    else
                        {
                            return false;
                        }

                }
        }
    else
        {
            return false;
        }
}




?>